import * as mongoose from 'mongoose';
import * as mongoosePaginate from 'mongoose-paginate';

import blogSchema from './blog';
import contactSchema from './contact';
import dictionarySchema from './dictionary';
import dictionaryTypeSchema from './dictionary-type';
import fileSchema from './file';
import loginUsersSchema from './login-users';
import subscribeSchema from './subscribe';
import userSchema from './user';

export const BlogModel = mongoose.model('blog', blogSchema);
export const DictionaryModel = mongoose.model('dictionary', dictionarySchema);
export const ContactModel = mongoose.model('contact', contactSchema);
export const DictionaryTypeModel = mongoose.model(
  'dictionary-type',
  dictionaryTypeSchema,
);
export const FileModel = mongoose.model('file', fileSchema);
export const LoginUsersModel = mongoose.model('login-users', loginUsersSchema);
export const SubscribeModel = mongoose.model('subscribe', subscribeSchema);
export const UserModel = mongoose.model('user', userSchema);

export const BlogModelProvider = {
  provide: 'BLOG_MODEL',
  useValue: BlogModel,
  inject: ['DATABASE_CONNECTION'],
};

export const ContactModelProvider = {
  provide: 'CONTACT_MODEL',
  useValue: ContactModel,
  inject: ['DATABASE_CONNECTION'],
};

export const DictionaryModelProvider = {
  provide: 'DICTIONARY_MODEL',
  useValue: DictionaryModel,
  inject: ['DATABASE_CONNECTION'],
};

export const DictionaryTypeModelProvider = {
  provide: 'DICTIONARY_TYPE_MODEL',
  useValue: DictionaryTypeModel,
  inject: ['DATABASE_CONNECTION'],
};

export const FileModelProvider = {
  provide: 'FILE_MODEL',
  useValue: FileModel,
  inject: ['DATABASE_CONNECTION'],
};

export const LoginUserModelProvider = {
  provide: 'LOGIN_USERS_MODEL',
  useValue: LoginUsersModel,
  inject: ['DATABASE_CONNECTION'],
};

export const SubscribeModelProvider = {
  provide: 'SUBSCRIBE_MODEL',
  useValue: SubscribeModel,
  inject: ['DATABASE_CONNECTION'],
};

export const UserModelProvider = {
  provide: 'USER_MODEL',
  useValue: UserModel,
  inject: ['DATABASE_CONNECTION'],
};
